﻿<%@ Page Language="C#" EnableEventValidation="false"  MasterPageFile="~/Design/MasterPage/MasterPage.master" AutoEventWireup="true" CodeFile="EmployeesSearchForm.aspx.cs" Inherits="App_Commons_EmployeesSearchForm" Title="职员检索画面"%>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script language="javascript" type="text/javascript">
    function jobIdChange(object)
    {
     CommonAjaxUtils.FindPositions(object.value,get_jobId_Result_CallBack);

    }
    
     function get_jobId_Result_CallBack(response)
    {
        if (response.value != null)
        {                    

            var drop = window.document.getElementById('<%=dropJobId.ClientID %>');
            drop.length=0;　　　　            
            var ds = response.value;
            if(ds != null && typeof(ds) == "object")
            {                   
　　                drop.options.add(new Option("",""));
                for(var i=0; i<ds.length; i++)
                {
       
　　                var name=ds[i].JobName;
　　                var id=ds[i].JobId;
　　                drop.options.add(new Option(name,id));
                }                
            }
        }
        return
    }
    
    function selectAll()
    {
        for(i=0; i<aspnetForm.elements.length; i++)
        {
            
            var e = aspnetForm.elements[i];
            if (e.type == "checkbox" && !e.checked)
            {
                e.checked=true;
                
            }
        }
    }
     function cancelAll()
    {
        for(i=0; i<aspnetForm.elements.length; i++)
        {
            
            var e = aspnetForm.elements[i];
            if (e.type == "checkbox" && e.checked)
            {
                e.checked=false;
                
            }
        }
    }
</script>
    <div>
    <table class="table_border_bg">
        <tr>
            <td colspan="6" align="center"><b>职员检索画面<br />
               
            </b></td>
        </tr>
    </table>
        <table width="100%">
      <tr>
        <td>
             <table class="table_border_line">
             <tr>
			    <td align="left" colspan="4" >
			        <script language="javascript">
                        (new TitleBar('SearchBar', '检索结果')).showBar();
                    </script>
			    </td>						
		      </tr>
             </table>
		    <table class="table_border_line" style="background-color:#ffffff">
                <tr>
                    <td style="width: 145px; height: 26px">
                    </td>
                    <td align="left" style="width: 68px; white-space: nowrap; height: 26px">
                        编号</td>
                    <td align="left" style="height: 26px">
                        &nbsp;<asp:TextBox ID="txtEmployeeId" runat="server" MaxLength="4" Width="100px"></asp:TextBox></td>
                    <td align="right" style="height: 26px">
                    </td>
                </tr>
                <tr>
                    <td style="width: 145px; height: 33px">
                    </td>
                    <td align="left" style="width: 68px; white-space: nowrap; height: 33px">
                    姓名</td>
                    <td align="left" style="height: 33px">
                        &nbsp;<asp:TextBox ID="txtEmployeeName" runat="server" MaxLength="100" Width="100px"></asp:TextBox></td>
                    <td align="right" style="height: 33px">
                    </td>
                </tr>
		      
		      <tr>
			    <td style="width:145px; height: 32px;">&nbsp;</td>
			    <td style="width:68px; white-space:nowrap; height: 32px;" align="left">
                    部门</td>
			    <td align="left" style="height: 32px">
                    &nbsp;<asp:DropDownList ID="dropGroupId" runat="server" DataTextField="departName" DataValueField="departId" onchange="jobIdChange(this)" Width="100px">
                    </asp:DropDownList></td>
			    <td align="right" style="height: 32px">&nbsp;</td>						
		      </tr>					
		      <tr>
			    <td style="width:145px; height: 33px;">&nbsp;</td>
			    <td style="width:68px; white-space:nowrap; height: 33px;" align="left">
                    职位</td>
			    <td align="left" style="height: 33px">
                    &nbsp;<asp:DropDownList ID="dropJobId" runat="server" DataTextField="JobName" DataValueField="JobId" Width="127px">
                    </asp:DropDownList></td>
			    <td align="right" style="height: 33px">&nbsp;</td>						
		      </tr>	
		      
           </table></td>
      </tr>
      <tr>
        <td align="center" style="height: 47px">
          <table>
             <tr>
                <td style="width:80px; height: 20px;">
                    <asp:Button ID="btnSeach" runat="server" Text="检 索" Width="100%" OnClick="btnSeach_Click" CssClass="button"/></td>						
             </tr>
          </table>    </td>
      </tr>
    </table>

    <br/>
    <table id="tabEmps" runat="server"  class="table_border_bg" visible="false" >
        <tr>
            <td >
            <a href="#" onclick="selectAll()">全选/</a><a href="#" onclick="cancelAll()">取消</a>
            </td>
        </tr>
       <tr>
        <td >
            <asp:GridView ID="GridView1"   runat="server"  AutoGenerateColumns="False" Width="100%"
             CssClass="GridView_table"  OnRowDataBound="GridView1_RowDataBound"
               OnPageIndexChanging="GridView1_PageIndexChanging"   >
                <Columns>
                     <asp:BoundField HeaderText="编号" DataField="EmployeeId"  >
                        <ItemStyle CssClass="GridView_item_center" />
                        <HeaderStyle CssClass="GridView_head_grayblue" />
                    </asp:BoundField>
                    <asp:BoundField HeaderText="姓名" DataField="EmployeeName"  >
                        <ItemStyle CssClass="GridView_item_center" />
                        <HeaderStyle CssClass="GridView_head_grayblue" />
                    </asp:BoundField>
                    <asp:BoundField HeaderText="职位" DataField="JobName"  >
                        <ItemStyle CssClass="GridView_item_center" />
                        <HeaderStyle CssClass="GridView_head_grayblue" />
                    </asp:BoundField>
                    <asp:BoundField HeaderText="部门" DataField="DepartName">
                        <ItemStyle CssClass="GridView_item_center" />
                        <HeaderStyle CssClass="GridView_head_grayblue" />
                    </asp:BoundField>
                    <asp:TemplateField HeaderText="选择">
                        <EditItemTemplate>
                            <asp:CheckBox ID="CheckBox1" runat="server" />
                        </EditItemTemplate>
                         <ItemStyle CssClass="GridView_item_center" />
                        <HeaderStyle CssClass="GridView_head_grayblue" />
                        <ItemTemplate>
                            <asp:CheckBox ID="CheckBox1" runat="server" />
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" />
            </asp:GridView>
        </td>
       </tr>	
        <tr>
            <td>
            <a href="#" onclick="selectAll()">全选/</a><a href="#" onclick="cancelAll()">取消</a>
            </td>
        </tr>
        <tr>
            <td align="center">
                <asp:Button ID="btnOk" runat="server" Text="确定" CssClass="button" Width="83px"   OnClientClick ="selectEmployee()" OnClick="btnOk_Click"/>
                <asp:Button ID="Button2" runat="server" Text="取消" CssClass="button" Width="83px" Visible="False" /></td>
        </tr>
      </table>
    </div>
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="Load"
            TypeName="Shpm.App.Master.Dao.EmployeeDao">
            <SelectParameters>
                <asp:ControlParameter ControlID="dropGroupId" Name="departId" PropertyName="Text"
                    Type="String" />
                <asp:ControlParameter ControlID="dropJobId" Name="jobId" PropertyName="Text" Type="String" />
                <asp:ControlParameter ControlID="txtEmployeeName" Name="name" PropertyName="Text"
                    Type="String" />
                <asp:ControlParameter ControlID="txtEmployeeId" Name="employeeId" PropertyName="Text" />
            </SelectParameters>
        </asp:ObjectDataSource>

            <asp:HiddenField ID="hidEmps" runat="server" />
</asp:Content>

